Skip to content

[rlc-8/4.18.0-553.123.1.el8_10] xfrm: esp: avoid in-place decrypt on shared skb frags#1198

Merged
shreeya-patel98 merged 1 commit into
rlc-8/4.18.0-553.123.1.el8_10from
{rnicolescu}_rlc-8/4.18.0-553.123.1.el8_10
May 8, 2026
Merged

[rlc-8/4.18.0-553.123.1.el8_10] xfrm: esp: avoid in-place decrypt on shared skb frags#1198
shreeya-patel98 merged 1 commit into
rlc-8/4.18.0-553.123.1.el8_10from
{rnicolescu}_rlc-8/4.18.0-553.123.1.el8_10

Conversation

@ciq-kernel-automation

@ciq-kernel-automation ciq-kernel-automation Bot commented May 8, 2026

Copy link
Copy Markdown

Local test

[rnicolescu@localhost kernel-src-tree]$ uname -r
4.18.0-rnicolescu_rlc-8_4.18.0-553.123.1.el8_10-e8755fda72e0+
[rnicolescu@localhost kernel-src-tree]$ git log -1 --format=%h
e8755fda72e0
frag.git && cd dirtyfrag && gcc -O0 -Wall -o exp exp.c -lutil && ./exp4bel/dirtyf
Cloning into 'dirtyfrag'...
remote: Enumerating objects: 46, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 46 (delta 5), reused 4 (delta 4), pack-reused 34 (from 1)
Receiving objects: 100% (46/46), 5.83 MiB | 2.17 MiB/s, done.
Resolving deltas: 100% (15/15), done.
[  155.765165] alg: No test for authencesn(hmac(sha256),cbc(aes)) (authencesn(hmac(sha256-ni),cbc-aes-aesni))
[  155.769436] alg: No test for echainiv(authencesn(hmac(sha256),cbc(aes))) (echainiv(authencesn(hmac(sha256-ni),cbc-aes-aesni)))
dirtyfrag: failed (rc=1)
[rnicolescu@localhost dirtyfrag]$ id
uid=1000(rnicolescu) gid=1000(rnicolescu) groups=1000(rnicolescu) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Summary

This PR has been automatically created after successful completion of all CI stages.

Commit Message(s)

xfrm: esp: avoid in-place decrypt on shared skb frags

unpub-cve DIRTY-FRAG
commit-author Kuan-Ting Chen <h3xrabbit@gmail.com>
commit f4c50a4034e62ab75f1d5cdd191dd5f9c77fdff4
upstream-diff |
	While this kernel lacks MSG_SPLICE_PAGES, it still has udp_sendpage().
	Upstream didn't patch udp_sendpage() because sendpage was removed
	entirely in favor of MSG_SPLICE_PAGES. In this kernel, splice() can
	still attach a page cache page to an IPv4 datagram via sendpage.
	Therefore, udp_sendpage() must be patched instead. And there is no
	patch for IPv6 datagrams because it isn't affected; there's no
	sendpage callback for IPv6 UDP.
	Due to missing 06b4feb37e64 ("net: group skb_shinfo zerocopy related bits together.")
	SKBFL_SHARED_FRAG was replaced with SKBTX_SHARED_FRAG.
	Also replaced flags with tx_flags.

Test Results

✅ Build Stage

Architecture Build Time Total Time
x86_64 25m 39s 26m 34s
aarch64 11m 5s 11m 46s

✅ Boot Verification

✅ Kernel Selftests

Architecture Passed Failed Compared Against Status
x86_64 121 35 rlc-8/4.18.0-553.123.1.el8_10 ⚠️ No baseline available
aarch64 72 32 rlc-8/4.18.0-553.123.1.el8_10 ⚠️ No baseline available

✅ LTP Results

Architecture Passed Failed Compared Against Status
x86_64 1381 83 rlc-8/4.18.0-553.123.1.el8_10 ⚠️ No baseline available
aarch64 1380 84 rlc-8/4.18.0-553.123.1.el8_10 ⚠️ No baseline available

🤖 This PR was automatically generated by GitHub Actions
Run ID: 25546132093

unpub-cve DIRTY-FRAG
commit-author Kuan-Ting Chen <h3xrabbit@gmail.com>
commit f4c50a4
upstream-diff |
	While this kernel lacks MSG_SPLICE_PAGES, it still has udp_sendpage().
	Upstream didn't patch udp_sendpage() because sendpage was removed
	entirely in favor of MSG_SPLICE_PAGES. In this kernel, splice() can
	still attach a page cache page to an IPv4 datagram via sendpage.
	Therefore, udp_sendpage() must be patched instead. And there is no
	patch for IPv6 datagrams because it isn't affected; there's no
	sendpage callback for IPv6 UDP.
	Due to missing 06b4feb ("net: group skb_shinfo zerocopy related bits together.")
	SKBFL_SHARED_FRAG was replaced with SKBTX_SHARED_FRAG.
	Also replaced flags with tx_flags.

MSG_SPLICE_PAGES can attach pages from a pipe directly to an skb. TCP
marks such skbs with SKBFL_SHARED_FRAG after skb_splice_from_iter(),
so later paths that may modify packet data can first make a private
copy. The IPv4/IPv6 datagram append paths did not set this flag when
splicing pages into UDP skbs.

That leaves an ESP-in-UDP packet made from shared pipe pages looking
like an ordinary uncloned nonlinear skb. ESP input then takes the no-COW
fast path for uncloned skbs without a frag_list and decrypts in place
over data that is not owned privately by the skb.

Mark IPv4/IPv6 datagram splice frags with SKBFL_SHARED_FRAG, matching
TCP. Also make ESP input fall back to skb_cow_data() when the flag is
present, so ESP does not decrypt externally backed frags in place.
Private nonlinear skb frags still use the existing fast path.

This intentionally does not change ESP output. In esp_output_head(),
the path that appends the ESP trailer to existing skb tailroom without
calling skb_cow_data() is not reachable for nonlinear skbs:
skb_tailroom() returns zero when skb->data_len is nonzero, while ESP
tailen is positive. Thus ESP output will either use the separate
destination-frag path or fall back to skb_cow_data().

Fixes: cac2661 ("esp4: Avoid skb_cow_data whenever possible")
Fixes: 03e2a30 ("esp6: Avoid skb_cow_data whenever possible")
Fixes: 7da0dde ("ip, udp: Support MSG_SPLICE_PAGES")
Fixes: 6d8192b ("ip6, udp6: Support MSG_SPLICE_PAGES")
	Reported-by: Hyunwoo Kim <imv4bel@gmail.com>
	Reported-by: Kuan-Ting Chen <h3xrabbit@gmail.com>
	Tested-by: Hyunwoo Kim <imv4bel@gmail.com>
	Cc: stable@vger.kernel.org
	Signed-off-by: Kuan-Ting Chen <h3xrabbit@gmail.com>
	Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
(cherry picked from commit f4c50a4)
	Signed-off-by: Shreeya Patel <spatel@ciq.com>
	Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
@ciq-kernel-automation ciq-kernel-automation Bot added the created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI) label May 8, 2026
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/25554978388

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🔍 Upstream Linux Kernel Commit Check

  • ⚠️ PR commit e8755fda72e0 (xfrm: esp: avoid in-place decrypt on shared skb frags) does not reference a CVE but
    upstream commit f4c50a4034e6 is associated with CVE-2026-43284

This is an automated message from the kernel commit checker workflow.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

🔍 Interdiff Analysis

  • ⚠️ PR commit e8755fda72e0 (xfrm: esp: avoid in-place decrypt on shared skb frags) → upstream f4c50a4034e6
    Differences found:
================================================================================
*    DELTA DIFFERENCES - code changes that differ between the patches          *
================================================================================

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1347,9 +1347,6 @@
 			goto error;
 		}
 
-		if (!(flags & MSG_NO_SHARED_FRAGS))
-			skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG;
-
 		if (skb->ip_summed == CHECKSUM_NONE) {
 			__wsum csum;
 			csum = csum_page(page, offset, len);

################################################################################
!    REJECTED PATCH2 HUNKS - could not be compared; manual review needed       !
################################################################################

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1233,6 +1233,8 @@
 			if (err < 0)
 				goto error;
 			copy = err;
+			if (!(flags & MSG_NO_SHARED_FRAGS))
+				skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
 			wmem_alloc_delta += copy;
 		} else if (!zc) {
 			int i = skb_shinfo(skb)->nr_frags;

================================================================================
*    CONTEXT DIFFERENCES - surrounding code differences between the patches    *
================================================================================

--- b/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1230,6 +1230,6 @@
-			goto error;
-		}
-
-		if (skb->ip_summed == CHECKSUM_NONE) {
-			__wsum csum;
-			csum = csum_page(page, offset, len);
+			if (err < 0)
+				goto error;
+			copy = err;
+			wmem_alloc_delta += copy;
+		} else if (!zc) {
+			int i = skb_shinfo(skb)->nr_frags;

================================================================================
*    ONLY IN PATCH2 - files not modified by patch1                             *
================================================================================

--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -915,7 +915,8 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
 			nfrags = 1;
 
 			goto skip_cow;
-		} else if (!skb_has_frag_list(skb)) {
+		} else if (!skb_has_frag_list(skb) &&
+			   !skb_has_shared_frag(skb)) {
 			nfrags = skb_shinfo(skb)->nr_frags;
 			nfrags++;
 
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1794,6 +1794,8 @@ alloc_new_skb:
 			if (err < 0)
 				goto error;
 			copy = err;
+			if (!(flags & MSG_NO_SHARED_FRAGS))
+				skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG;
 			wmem_alloc_delta += copy;
 		} else if (!zc) {
 			int i = skb_shinfo(skb)->nr_frags;

This is an automated interdiff check for backported commits.

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/25554978388

@bmastbergen bmastbergen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥌

@jdieter

jdieter commented May 8, 2026

Copy link
Copy Markdown

Maybe a dumb question, but is there a reason we're not also patching net/ipv6/ as well as net/ipv4?

@shreeya-patel98

Copy link
Copy Markdown
Collaborator

Maybe a dumb question, but is there a reason we're not also patching net/ipv6/ as well as net/ipv4?

@jdieter that's a very good question. I don't think we have checked if ipv6 is affected or not. I'll have a look at it.

@shreeya-patel98 shreeya-patel98 merged commit f933b95 into rlc-8/4.18.0-553.123.1.el8_10 May 8, 2026
4 checks passed
@roxanan1996 roxanan1996 deleted the {rnicolescu}_rlc-8/4.18.0-553.123.1.el8_10 branch June 8, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI)

Development

Successfully merging this pull request may close these issues.

4 participants